SelectCase

Syntax:

@SelectCase variable

@Case expression [,expression]

@commands

@Case Else

@commands

@EndSelect

The Case command enables conditional processing dependant upon the value of the SelectCase variable. Subsequent Case expressions can then give the value (or values) of the variable which, if one or more are true, will execute the following @commands. The Else parameter can be used to trap any remaining values. Only one Case statement in the set can be executed, that is, if more than one case statement's conditions are true, only the first will be effective. EndSelect designates the end of the set of Case statements. Indentation is optional and solely used to improve readability.

Example

@SelectCase Grade
@Case 'Director', 'Senior Manager'
@Assign JobCategory = 'Higher Management'
@Assign Count1 = Count1 + 1
@Case 'Junior Manager'
@Assign JobCategory = 'Lower Management'
@Assign Count2 = Count2 + 1
@Case Else
@Assign JobCategory = 'Some other category'
@Assign Count2 = Count2 + 1
@EndSelect

where Grade is a List attribute, with values Director, Senior Manager, etc. The Variable tested can be any type of attribute or other variable (array, string, etc.). Variables as well as literal values can also be used in the expression.

Example:

@SelectCase Num
@Case 10, 20, 30
@Assign NumArray[5] = 10
@Case Num2
@Assign  NumArray[5] = 0
@Case Else
@Assign NumArray[5] = 1000
@EndSelect